package com.example.controller;

import com.example.pojo.entity.PostDocument;
import com.example.service.PostDocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小岁
 * @version 2023/10/24 19:44
 */
@RestController
public class PostDocumentController {
    @Autowired
    private PostDocumentService postDocumentService;

    public PostDocumentController(PostDocumentService postDocumentService){
        this.postDocumentService=postDocumentService;
    }

    @PostMapping("/post/search")
    public SearchHits<PostDocument> search(String key){
        return postDocumentService.searchPostDocument(key);
    }
}
